\documentclass{article}
\usepackage{amssymb,amsmath}
\usepackage[landscape,margin=0.2in]{geometry}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{rotating}
\usepackage{comment}

\begin{document}

\begin{tabular}{| r l l |}
\hline
	\multicolumn{3}{| c |}{\textbf{TCP}}\\
\hline
	$SampleRTT$ & & Point sample of a RTT on a TCP connection\\
	$EstimatedRTT$ & $.875 * EstimatedRTT + .125 * SampleRTT$ & Estimated RTT\\
	$DevRTT$ & $(1 - a)DevRTT + \beta|SampleRTT - EstimatedRTT|$ & Deviation in RTT\\
	$TimeoutInterval$ & $EstimatedRTT + 4DevRTT$ & Connection timeout\\
	ACK rule & \multicolumn{2}{l |}{Delay transmission of ACK 500msec if there is no segment already awaiting acknowledgement}\\
\hline
\end{tabular}

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
	\multicolumn{33}{|c|}{\textbf{Packet Structure (32 bits wide)}}\\
\hline
	& 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 & 25 & 26 & 27 & 28 & 29 & 30 & 31\\
\hline
	\multirow{3}{*}{\rotatebox{90}{\textbf{Ethernet II}}}
		& \multicolumn{16}{|c}{\multirow{2}{*}{Destination MAC}} & \multicolumn{16}{c|}{}\\
		\cline{18-33}
		& \multicolumn{16}{|c|}{} & \multicolumn{16}{|c|}{\multirow{2}{*}{Source MAC}}\\
		\cline{2-17}
		& \multicolumn{32}{|c|}{}\\
		\cline{2-33}
		& \multicolumn{16}{|c|}{Frame Type} & \multicolumn{16}{|c|}{\textit{Data (stuff below)}}\\
		\cline{2-33}
		& \multicolumn{32}{|c|}{CRC}\\
\hline
	\multirow{3}{*}{\rotatebox{90}{\textbf{ICMP}}}
		& \multicolumn{8}{|c|}{Type} & \multicolumn{8}{|c|}{Code} & \multicolumn{16}{|c|}{Checksum}\\
		\cline{2-33}
		& \multicolumn{32}{|c|}{varies with type}\\
		\cline{2-33}
		& \multicolumn{32}{|c|}{IP header + 8 bytes of original datagram}\\
\hline
	\multirow{6}{*}{\rotatebox{90}{\textbf{IPv4}}}
		& \multicolumn{4}{|c|}{Version} & \multicolumn{4}{|c|}{Header Len} & \multicolumn{8}{|c|}{TOS} & \multicolumn{16}{|c|}{Len}\\
		\cline{2-33}
		& \multicolumn{16}{|c|}{ID} & \multicolumn{3}{|c|}{Frag Flags} & \multicolumn{13}{|c|}{Fragment Offset}\\
		\cline{2-33}
		& \multicolumn{8}{|c|}{TTL} & \multicolumn{8}{|c|}{Protocol} & \multicolumn{16}{|c|}{Header Checksum}\\
		\cline{2-33}
		& \multicolumn{32}{|c|}{Source IP}\\
		\cline{2-33}
		& \multicolumn{32}{|c|}{Destination IP}\\
		\cline{2-33}
		& \multicolumn{32}{|c|}{Options (optional, specified by header len)}\\
\hline
	\multirow{10}{*}{\rotatebox{90}{\textbf{IPv6}}}
		& \multicolumn{4}{|c|}{Version} & \multicolumn{4}{|c|}{Priority} & \multicolumn{24}{|c|}{Flow label}\\
		\cline{2-33}
		& \multicolumn{16}{|c|}{Payload len} & \multicolumn{8}{|c|}{Next header} & \multicolumn{8}{|c|}{Hop limit}\\
		\cline{2-33}
		& \multicolumn{32}{|c|}{\multirow{4}{*}{Source address}}\\
		& \multicolumn{32}{|c|}{}\\
		& \multicolumn{32}{|c|}{}\\
		& \multicolumn{32}{|c|}{}\\
		\cline{2-33}
		& \multicolumn{32}{|c|}{\multirow{4}{*}{Destination address}}\\
		& \multicolumn{32}{|c|}{}\\
		& \multicolumn{32}{|c|}{}\\
		& \multicolumn{32}{|c|}{}\\
\hline
	\multirow{6}{*}{\rotatebox{90}{\textbf{TCP}}}
		& \multicolumn{16}{|c|}{Source Port \#} & \multicolumn{16}{|c|}{Dest Port \#}\\ 
		\cline{2-33}
                & \multicolumn{32}{|c|}{Sequence Number}\\
		\cline{2-33}
                & \multicolumn{32}{|c|}{ACK Number}\\
		\cline{2-33}
		& \multicolumn{4}{|c|}{Header Len} & \multicolumn{6}{|c|}{Unused} & \rotatebox{90}{URG} & \rotatebox{90}{ACK} & \rotatebox{90}{PSH} & \rotatebox{90}{RST} & \rotatebox{90}{SYN} & \rotatebox{90}{FIN} & \multicolumn{16}{|c|}{Receive Window}\\
		\cline{2-33} 
		& \multicolumn{16}{|c|}{Checksum} & \multicolumn{16}{|c|}{Urgent Data Pointer}\\ 
		\cline{2-33}
                & \multicolumn{32}{|c|}{Options (optional, specified by header len)}\\
\hline
	\multirow{2}{*}{\rotatebox{90}{\textbf{UDP}}}
		& \multicolumn{16}{|c|}{Source Port} & \multicolumn{16}{|c|}{Dest Port}\\
		\cline{2-33}
		& \multicolumn{16}{|c|}{Length} & \multicolumn{16}{|c|}{Checksum}\\
\hline
\end{tabular}

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
\multicolumn{13}{|c|}{\textbf{802.11 Frame}}\\
\hline
0B & 1 & 2 & 3 & 4-9 & 10-15 & 16-21 & 22 & 23 & 24-29 & 30 & 31 & 32\\
\hline
\multicolumn{2}{|c|}{Frame Ctrl} & \multicolumn{2}{|c|}{Dur} & Recv Addr & Tx Addr & Router Addr & \multicolumn{2}{|c|}{Seq Ctrl} & WDS & \multicolumn{1}{|c|}{Data} & \multicolumn{2}{|c|}{CRC}\\
\hline
\end{tabular}

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
\multicolumn{16}{|c|}{\textbf{Frame Ctrl}}\\
\hline
0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15\\
\hline
\multicolumn{2}{|c|}{Ver} & \multicolumn{2}{|c|}{Type} & \multicolumn{4}{|c|}{Subtype} & To & From & More Frag & Retry & Pwr & More Data & WEP & Rswd\\
\hline
\end{tabular}
\begin{tabular}{|rl|}
\hline
\multicolumn{2}{|c|}{PPP}\\
\hline
Flag & 0x7E\\
Byte stuffing & 0x7D, complement sixth bit of next\\
\hline
\end{tabular}

\twocolumn

\begin{tabular}{|rll|}
\hline
\multicolumn{3}{|c|}{\textbf{Routing Algorithms}}\\
\hline
Global & Link State & Dijkstra: OSPF\\
Decentralized & Distance vector & Bellman-Ford: RIP\\
\hline
\end{tabular}

\begin{tabular}{| r l l |}
\hline
	\multicolumn{3}{| c |}{\textbf{Basic Links}}\\
\hline
	$L$ &  & Packet size (bits)\\
	$R$ &  & Rate of transmission (bits/sec)\\
	$m$ &  & Distance of line\\
	$s$ &  & Line speed (meter/sec)\\
	$D_{trans}$ & $L/R$ & Transmission delay (s)\\
	$D_{prop}$ & $m/s$ & Propogation delay (s)\\
	$RTT$ & $2*D_{prop}$ & Round Trip Time (s)\\
	B-D product & $R*D_{prop}$ & No ACKs (b)\\
		      & $R*RTT$ & With ACKs (b)\\
	$U$ & $\displaystyle \frac{L/R}{RTT+L/R}$ & Utilization per packet (percentage)\\
\hline
\end{tabular}

\begin{tabular}{ccccccccccccccccccccc}
\multicolumn{21}{c}{\textbf{CRC Example}}\\
\multicolumn{6}{c}{Generator} & \multicolumn{10}{c}{Data} & \multicolumn{5}{c}{r}\\
\cline{7-21}
1 & 1 & 0 & 1 & 0 & 1 & \multicolumn{1}{|c}{1} & 0 & 1 & 0 & 0 & 0 & 1 & 1 & 0 & 1 & \textit{0} & \textit{0} & \textit{0} & \textit{0} & \textit{0}\\
\multicolumn{6}{c}{} & 1 & 1 & 0 & 1 & 0 & 1\\
\cline{7-12}
\multicolumn{7}{c}{} & 1 & 1 & 1 & 0 & 1 & 1\\
\multicolumn{7}{c}{} & 1 & 1 & 0 & 1 & 0 & 1\\
\cline{8-13}
\multicolumn{9}{c}{} & 1 & 1 & 1 & 0 & 1 & 0\\
\multicolumn{9}{c}{} & 1 & 1 & 0 & 1 & 0 & 1\\
\cline{10-15}
\multicolumn{11}{c}{} & 1 & 1 & 1 & 1 & 1 & 0\\
\multicolumn{11}{c}{} & 1 & 1 & 0 & 1 & 0 & 1\\
\cline{12-17}
\multicolumn{13}{c}{} & 1 & 0 & 1 & 1 & 0 & 0\\
\multicolumn{13}{c}{} & 1 & 1 & 0 & 1 & 0 & 1\\
\cline{14-19}
\multicolumn{14}{c}{} & 1 & 1 & 0 & 0 & 1 & 0\\
\multicolumn{14}{c}{} & 1 & 1 & 0 & 1 & 0 & 1\\
\cline{15-20}
\multicolumn{16}{c}{} & \textbf{0} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{0}\\
\end{tabular}
\begin{tabular}{|rl|}
\hline
\multicolumn{2}{|c|}{\textbf{Misc Ethernet}}\\
\hline
CSMA/CD & Listen, tx, detect, backoff\\
	& Backoff exp * 512 bit times\\
        & 1-persist, send immediately\\
        & Non-persist, back off random amount\\
Min frame len & 64 bytes\\
Max wire len & 2500m\\
Manchester Encoding & 1: L-\textgreater H; 0: H-\textgreater L\\
Efficiency & $e=\frac{1}{1+5\frac{t_{prop}}{t_{trans}}}$\\
\hline
\end{tabular}

\begin{tabular}{|rl|}
\hline
\multicolumn{2}{|c|}{\textbf{Wireless}}\\
\hline
dB & $N_{dB} = 10 \log_{10}(\frac{P_1}{P_2})$\\
   & 3dB = double power\\
   & 10dB = 10x power\\
DSSS & Code of -1/1s, x byte (0: -1/1: 1)\\
CSMA/CA & RTS/CTS for larger frames\\
\hline
\end{tabular}
\begin{tabular}{|rl|}
\hline
\multicolumn{2}{|c|}{\textbf{Wifi Conn (AP - Host)}}\\
\hline
\textgreater & Probe request\\
\textless & Probe response\\
\textless & Auth request\\
\textgreater & Auth challenge\\
\textless & Auth response\\
\textgreater & Auth success\\
\textless & Assoc request\\
\textgreater & Assoc response\\
\hline
\end{tabular}

\begin{tabular}{|rl|}
\hline
\multicolumn{2}{|c|}{\textbf{DHCP (Server - Host}}\\
\hline
\textgreater & Discover\\
\textless & Offer\\
\textgreater & Request\\
\textless & ACK\\
\hline
\end{tabular}
\begin{tabular}{|rl|}
\hline
\multicolumn{2}{|c|}{\textbf{Encryption}}\\
\hline
AES & symmetric\\
RSA & asymetric\\
    & $msg_{enc} = m^e \% n$\\
    & $msg_{dec} = (msg_{enc})^d \% n$\\
\hline
\end{tabular}

\begin{verbatim}
Dijkstra:
Loop 
  find w not in N' such that D(w) is a minimum 
  add w to N' 
  update D(v) for all v adjacent to w and not in N' : 
     D(v) = min( D(v), D(w) + c(w,v) ) 
until all nodes in N' 
\end{verbatim}

\begin{verbatim}
Bellman-Ford:
loop 
  wait (until I see a link cost change to neighbor w 
    or until I receive update from neighbor w) 
 
  For each y in N:
    Dx(y) = minv{c(x,v) + Dv(y)}
 
  If Dx(y) changed for any destination y
    send distance vector Dx = [Dx(y): y in N] to all neighbors
forever 
\end{verbatim}

\begin{tabular}{|rl|}
\hline
\multicolumn{2}{|c|}{\textbf{CSMA/CA (AP - Host)}}\\
\hline
  & DIFS\\
\textless & RTS\\
  & SIFS\\
\textgreater & CTS\\
  & SIFS\\
\textless & Data\\
  & SIFS\\
\textgreater & ACK\\
  & DIFS\\
  & Contention window\\
\hline
\end{tabular}

\end{document}